From 26e617a773c7c6b01ca5da9a2065023d7795297c Mon Sep 17 00:00:00 2001 From: "awilliam@xenbuild.aw" Date: Fri, 24 Feb 2006 08:28:36 -0700 Subject: [PATCH] [IA64] cleanup itir_ps(), itir_mask() code clean up. itir_ps(), itir_mask() Signed-off-by: Isaku Yamahata --- xen/arch/ia64/xen/process.c | 2 +- xen/arch/ia64/xen/vcpu.c | 7 ++----- xen/include/asm-ia64/vcpu.h | 12 ++++++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/xen/arch/ia64/xen/process.c b/xen/arch/ia64/xen/process.c index 249b5e93b6..8e9d1e8158 100644 --- a/xen/arch/ia64/xen/process.c +++ b/xen/arch/ia64/xen/process.c @@ -94,7 +94,7 @@ unsigned long translate_domain_pte(unsigned long pteval, extern unsigned long dom0_start, dom0_size; // FIXME address had better be pre-validated on insert - mask = (1L << ((itir >> 2) & 0x3f)) - 1; + mask = itir_mask(itir); mpaddr = ((pteval & _PAGE_PPN_MASK) & ~mask) | (address & mask); if (d == dom0) { if (mpaddr < dom0_start || mpaddr >= dom0_start + dom0_size) { diff --git a/xen/arch/ia64/xen/vcpu.c b/xen/arch/ia64/xen/vcpu.c index a15b09981a..508383b92b 100644 --- a/xen/arch/ia64/xen/vcpu.c +++ b/xen/arch/ia64/xen/vcpu.c @@ -1293,9 +1293,6 @@ IA64FAULT vcpu_ttag(VCPU *vcpu, UINT64 vadr, UINT64 *padr) return (IA64_ILLOP_FAULT); } -#define itir_ps(itir) ((itir >> 2) & 0x3f) -#define itir_mask(itir) (~((1UL << itir_ps(itir)) - 1)) - unsigned long vhpt_translate_count = 0; unsigned long fast_vhpt_translate_count = 0; unsigned long recover_to_page_fault_count = 0; @@ -1798,7 +1795,7 @@ void vcpu_itc_no_srlz(VCPU *vcpu, UINT64 IorD, UINT64 vaddr, UINT64 pte, UINT64 IA64FAULT vcpu_itc_d(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa) { - unsigned long pteval, logps = (itir >> 2) & 0x3f; + unsigned long pteval, logps = itir_ps(itir); unsigned long translate_domain_pte(UINT64,UINT64,UINT64); BOOLEAN swap_rr0 = (!(ifa>>61) && PSCB(vcpu,metaphysical_mode)); @@ -1818,7 +1815,7 @@ IA64FAULT vcpu_itc_d(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa) IA64FAULT vcpu_itc_i(VCPU *vcpu, UINT64 pte, UINT64 itir, UINT64 ifa) { - unsigned long pteval, logps = (itir >> 2) & 0x3f; + unsigned long pteval, logps = itir_ps(itir); unsigned long translate_domain_pte(UINT64,UINT64,UINT64); BOOLEAN swap_rr0 = (!(ifa>>61) && PSCB(vcpu,metaphysical_mode)); diff --git a/xen/include/asm-ia64/vcpu.h b/xen/include/asm-ia64/vcpu.h index 18ec988891..492a759ea5 100644 --- a/xen/include/asm-ia64/vcpu.h +++ b/xen/include/asm-ia64/vcpu.h @@ -149,4 +149,16 @@ extern void vcpu_itc_no_srlz(VCPU *vcpu, UINT64, UINT64, UINT64, UINT64, UINT64) extern UINT64 vcpu_get_tmp(VCPU *, UINT64); extern void vcpu_set_tmp(VCPU *, UINT64, UINT64); +static inline UINT64 +itir_ps(UINT64 itir) +{ + return ((itir >> 2) & 0x3f); +} + +static inline UINT64 +itir_mask(UINT64 itir) +{ + return (~((1UL << itir_ps(itir)) - 1)); +} + #endif -- 2.30.2